/*
  DuinolabBlink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is based on the Arduino Blink example.
 */

#include <Duinolab.h>
#include <Wire.h>      // need to get rid of this - Arduino IDE is too clever...

// DuinolabClass Duinolab = DuinolabClass(); 

void setup() {  
  // Connect LED 0 from the Duinolab  
  Duinolab.Init();  
  Duinolab.ConnectToArduino(POT_RED);
  Duinolab.ConnectToArduino(LED_YELLOW);
  Duinolab.ConnectToArduino(LED_AMBER);
  Duinolab.ConnectToArduino(LED_ORANGE);
  Duinolab.ConnectToArduino(LED_RED);
  Duinolab.ConnectToArduino(LED_GREEN);
  Duinolab.ConnectToArduino(LED_BLUE);
  Duinolab.LEDOn(LED_YELLOW);   // set the LED on
  Duinolab.LEDOn(LED_AMBER);   // set the LED on
  Duinolab.LEDOn(LED_ORANGE);   // set the LED on
  Duinolab.LEDOn(LED_RED);   // set the LED on
  Duinolab.LEDOn(LED_GREEN);   // set the LED on
  Duinolab.LEDOn(LED_BLUE);   // set the LED on
}

void loop() {
  uint16_t delaytime = 1023 - Duinolab.ReadPot(POT_RED);
  Duinolab.LEDOn(LED_YELLOW);
  delay(3+ delaytime);
  delaytime = 1023 - Duinolab.ReadPot(POT_RED);
  Duinolab.LEDOff(LED_YELLOW);
  delay(3+delaytime);
  

}
